package com.iplant.aps.service.mesenum;

import com.iplant.aps.service.po.cfg.CFGItem;

import java.util.ArrayList;
import java.util.List;

/**
 * 领料需求订单类型-新版，按行交接
 *
 * @author YouWang·Peng
 * 2022-1-6 10:13:30
 */
public enum WMSPickDemandStatusNew {
    /**
     * 默认
     */
    Default(0, "默认"),
    /**
     * 保存
     */
    Saved(1, "保存"),
    /**
     * 未开始
     */
    NotStart(2, "未开始"),
    /**
     * 进行中
     */
    Running(3, "进行中"),
    /**
     * 已完成
     */
    Finished(4, "已完成"),
    /**
     * 完工关闭
     */
    FinishClosed(5, "完工关闭"),
    /**
     * 已取消
     */
    Canceld(6, "已取消"),
    /**
     * 待交接
     */
    PendingHandover(7, "待交接"),
    /**
     * 已入库
     */
    AlreadyInStock(8, "已入库"),
    /**
     * 已出库
     */
    AlreadyShipped(9, "已出库"),
    /**
     * 已完工
     */
    AlreadyCompleted(10, "已完工");

    private final int value;
    private final String lable;

    WMSPickDemandStatusNew(int value, String lable) {
        this.value = value;
        this.lable = lable;
    }

    /**
     * 通过 value 的数值获取枚举实例
     */
    public static WMSPickDemandStatusNew getEnumType(int val) {
        for (WMSPickDemandStatusNew type : WMSPickDemandStatusNew.values()) {
            if (type.getValue() == val) {
                return type;
            }
        }
        return WMSPickDemandStatusNew.Default;
    }

    public static List<CFGItem> getEnumList() {
        List<CFGItem> wItemList = new ArrayList<>();

        for (WMSPickDemandStatusNew type : WMSPickDemandStatusNew.values()) {
            CFGItem wItem = new CFGItem();
            wItem.ID = type.getValue();
            wItem.ItemName = type.getLable();
            wItem.ItemText = type.getLable();
            wItemList.add(wItem);
        }
        return wItemList;
    }

    public int getValue() {
        return value;
    }

    public String getLable() {
        return lable;
    }
}
